import { createRouter, createWebHashHistory } from 'vue-router';
import routes from '@/router/routes';
import { mscf } from '@/utils';

const router = createRouter({
	history: createWebHashHistory(),
	routes
});

router.beforeEach((to, from, next) => {
	mscf.emit('routeChange', '*', to.fullPath);
	next();
});

router.afterEach((to, from) => {
	document.title = `${to.meta.title ? to.meta.title : '联联周边游'}`;
});

export default router;
